
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Day06 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="Day05-1.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="Day01.html">
            
                <a href="Day01.html">
            
                    
                    Day01
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="Day02.html">
            
                <a href="Day02.html">
            
                    
                    Day02
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="Day03.html">
            
                <a href="Day03.html">
            
                    
                    Day03
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="Day04-1.html">
            
                <a href="Day04-1.html">
            
                    
                    Day04-1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="Day04-2.html">
            
                <a href="Day04-2.html">
            
                    
                    Day04-2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="Day05-2.html">
            
                <a href="Day05-2.html">
            
                    
                    Day05-1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="Day05-1.html">
            
                <a href="Day05-1.html">
            
                    
                    Day05-2
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.9" data-path="Day06.html">
            
                <a href="Day06.html">
            
                    
                    Day06
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Day06</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="day06-lnmphdwikimysql&#x4E3B;&#x4ECE;&#x540C;&#x6B65;">Day06-LNMP+HDwiki+Mysql&#x4E3B;&#x4ECE;&#x540C;&#x6B65;</h1>
<p>Author&#xFF1A;<code>10-MF&#x8D3E;-Py201704024</code>
Date&#xFF1A;<code>6&#x6708;21&#x65E5;</code></p>
<p>[TOC]</p>
<h3 id="1-lnmp&#x642D;&#x5EFA;">1. LNMP&#x642D;&#x5EFA;</h3>
<h4 id="&#x6982;&#x5FF5;">&#x6982;&#x5FF5;</h4>
<p>L=Linux        linux&#x7CFB;&#x7EDF;
N=Nginx        Web&#x670D;&#x52A1;&#x5668;&#x548C;&#x53CD;&#x5411;&#x4EE3;&#x7406;
M=Mysql    &#x6570;&#x636E;&#x5E93;
P=PHP        &#x4E00;&#x79CD;&#x5F00;&#x6E90;&#x811A;&#x672C;&#x8BED;&#x8A00;&#xFF0C;&#x53EF;&#x4EE5;&#x5904;&#x7406;&#x52A8;&#x6001;web&#x9875;&#x9762;</p>
<h4 id="&#x5F00;&#x53D1;&#x5305;&#x5B89;&#x88C5;">&#x5F00;&#x53D1;&#x5305;&#x5B89;&#x88C5;</h4>
<pre><code class="lang-shell">yum -y groupinstall &quot;Development Tools&quot;
yum -y install libxml2* curl curl-devel libjpeg* libpng* libmcrypt*  freetype-devel
</code></pre>
<h4 id="nginx-&#x5B89;&#x88C5;">Nginx &#x5B89;&#x88C5;</h4>
<pre><code class="lang-shell">yum -y install nginx
</code></pre>
<h4 id="&#x4FEE;&#x6539;nginx&#x914D;&#x7F6E;&#x6587;&#x4EF6;">&#x4FEE;&#x6539;nginx&#x914D;&#x7F6E;&#x6587;&#x4EF6;</h4>
<pre><code class="lang-shell">vim /etc/nginx/nginx.conf
user  nginx nginx;
worker_processes 3;
error_log /var/log/nginx_error.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 65535;
events
{
  use epoll;
  worker_connections 65535;
}
http
{
  include       mime.types;
  default_type  application/octet-stream;
  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 8m;
  sendfile on;
  tcp_nopush     on;
  keepalive_timeout 60;
  tcp_nodelay on;

  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;

  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 16k;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;

  log_format www &apos;$remote_addr - $remote_user [$time_local] &quot;$request&quot; &apos;
                 &apos;$status $body_bytes_sent &quot;$http_referer&quot; &apos;
                 &apos;&quot;$http_user_agent&quot; $http_x_forwarded_for&apos;;

  server
  {
    listen       80;
    server_name 127.0.0.1 localhost;
    index start.php index.htm index.html index.php;
    root  /usr/share/nginx/html;

    location ~ .*\.(php|php5)?$
    {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index start.php;
      include fastcgi.conf;
    }
    location ~ .*.(svn|git|cvs)
    {
      deny all;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }
}
</code></pre>
<h4 id="mysql-&#x5B89;&#x88C5;">mysql &#x5B89;&#x88C5;</h4>
<pre><code class="lang-shell">yum -y install mysql mysql-server mysql-devel
</code></pre>
<h4 id="php-&#x5B89;&#x88C5;">PHP &#x5B89;&#x88C5;</h4>
<pre><code class="lang-shell">wget http://cn2.php.net/distributions/php-5.6.2.tar.gz

tar -xvf php-5.6.2.ta.rgz

cd php-5.6.2

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl --enable-bcmath --enable-sockets

make &amp;&amp; make install

&#x4FEE;&#x6539;&#x914D;&#x7F6E;&#xFF1A;
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /opt/php-5.6.2/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
</code></pre>
<h4 id="&#x914D;&#x7F6E;php&#x5E76;&#x9A8C;&#x8BC1;php">&#x914D;&#x7F6E;PHP&#x5E76;&#x9A8C;&#x8BC1;PHP</h4>
<pre><code class="lang-shell">vim /usr/local/php/etc/php-fpm
user=nginx
group=nginx
</code></pre>
<pre><code class="lang-shell">/etc/init.d/php-fpm start
</code></pre>
<pre><code class="lang-shell">/etc/init.d/nginx start
</code></pre>
<pre><code class="lang-shell">vim /usr/shara/nginx/html/cc.php  
&lt;?php
    phpinfo();  
?&gt;
</code></pre>
<p>&#x5728;&#x7535;&#x8111;&#x6D4F;&#x89C8;&#x5668;&#x4E0A;&#x80FD;&#x6253;&#x5F00;cc.php&#x8BF4;&#x660E;LNMP&#x5B89;&#x88C5;&#x5B8C;&#x6210;</p>
<h3 id="2-&#x642D;&#x5EFA;hdwiki&#x7F51;&#x7AD9;">2. &#x642D;&#x5EFA;HDwiki&#x7F51;&#x7AD9;</h3>
<h4 id="&#x5173;&#x95ED;nginx&#x548C;php&#x670D;&#x52A1;">&#x5173;&#x95ED;NGINX&#x548C;PHP&#x670D;&#x52A1;</h4>
<pre><code class="lang-shell">/etc/init.d/nginx stop
/etc/init.d/php-fpm stop
</code></pre>
<h4 id="&#x4E0B;&#x8F7D;hdwiki&#x5305;">&#x4E0B;&#x8F7D;HDWiki&#x5305;</h4>
<pre><code>cd /usr/shara/nginx/html/
wget http://kaiyuan.hudong.com/download.php?n=HDWiki-v6.0UTF8-20170209.zip
unzip HDWiki-v6.0UTF8-20170209.zip
mv hdwiki/* ./
chmod 777 uploads/ data/ plugins/ config.php style/default/logo.gif
</code></pre><h4 id="&#x5F00;&#x542F;nginx&#x548C;php&#x670D;&#x52A1;">&#x5F00;&#x542F;NGINX&#x548C;PHP&#x670D;&#x52A1;</h4>
<pre><code class="lang-shell">/etc/init.d/nginx start
/etc/init.d/php-fpm start
</code></pre>
<h4 id="&#x5F15;&#x5230;&#x914D;&#x7F6E;hdwiki">&#x5F15;&#x5230;&#x914D;&#x7F6E;HDWiki</h4>
<p>&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x4E2D;&#x6253;&#x5F00;&#xFF0C;&#x6309;&#x7167;&#x5F15;&#x5230;&#x914D;&#x7F6E;
&#x5B8C;&#x6210;</p>
<h4 id="&#x95EE;&#x9898;&#x4E0E;&#x601D;&#x8DEF;">&#x95EE;&#x9898;&#x4E0E;&#x601D;&#x8DEF;</h4>
<ul>
<li><p>&#x5F00;&#x542F;nginx&#x670D;&#x52A1;&#x5931;&#x8D25;</p>
</li>
<li><p>HDwiki&#x6253;&#x5F00;&#x65E0;&#x6837;&#x5F0F;</p>
</li>
</ul>
<p>&#x68C0;&#x67E5;nginx &#x548C; PHP &#x662F;&#x5426;&#x6B63;&#x786E;&#x6309;&#x7167;
&#x68C0;&#x67E5;/etc/nginx/nginx.conf &#x662F;&#x5426;&#x914D;&#x7F6E;&#x6B63;&#x786E;&#xFF0C;&#x53EF;&#x4EE5;&#x4FEE;&#x6539;&#x5E76;&#x4F7F;&#x7528;&#x522B;&#x4EBA;&#x7684;&#x914D;&#x7F6E;
&#x68C0;&#x67E5;/etc/nginx&#x4E0B;&#x662F;&#x5426;&#x5B58;&#x5728;fastcgi.conf&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5C31;&#x4ECE;&#x522B;&#x4EBA;&#x90A3;&#x62F7;&#x8D1D;&#x8FC7;&#x6765;</p>
<h3 id="3-mysql-&#x4E3B;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x540C;&#x6B65;&#x5B9E;&#x9A8C;">3. Mysql &#x4E3B;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x540C;&#x6B65;&#x5B9E;&#x9A8C;</h3>
<h4 id="&#x786E;&#x4FDD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x548C;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;mysql&#x7248;&#x672C;&#x4E00;&#x81F4;">&#x786E;&#x4FDD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x548C;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;mysql&#x7248;&#x672C;&#x4E00;&#x81F4;</h4>
<pre><code class="lang-shell">rpm -aq | grep mysql
mysql-libs-5.1.73-8.el6_8.x86_64
mysql-devel-5.1.73-8.el6_8.x86_64
mysql-5.1.73-8.el6_8.x86_64
mysql-server-5.1.73-8.el6_8.x86_64
</code></pre>
<h4 id="&#x786E;&#x4FDD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x548C;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;iptables&#x8BBE;&#x7F6E;&#x5408;&#x7406;">&#x786E;&#x4FDD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x548C;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;iptables&#x8BBE;&#x7F6E;&#x5408;&#x7406;</h4>
<pre><code class="lang-shell">iptables -nvL # &#x67E5;&#x770B;
iptables -F # &#x5982;&#x679C;&#x662F;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x76F4;&#x63A5;&#x6E05;&#x7A7A;&#x89C4;&#x5219;
&#x200B;`
</code></pre>
<h4 id="&#x4FEE;&#x6539;myconf">&#x4FEE;&#x6539;my.conf</h4>
<p>&#x200B;```shell
vim /etc/my.conf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
server-id=1
log-bin=mysql-bin</p>
<p>[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid</p>
<pre><code>
#### &#x786E;&#x4FDD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x548C;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;server id&#x662F;&#x4E0D;&#x76F8;&#x540C;&#x7684;
```shell
mysql&gt; show global variables like &apos;server_id&apos;;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 1     |
+---------------+-------+
1 row in set (0.00 sec)
</code></pre><pre><code class="lang-shell">mysql&gt; show global variables like &apos;server_id&apos;;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 2     |
+---------------+-------+
1 row in set (0.00 sec)
</code></pre>
<h4 id="&#x786E;&#x4FDD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x548C;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;bin-log&#x5F00;&#x542F;">&#x786E;&#x4FDD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x548C;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;bin log&#x5F00;&#x542F;</h4>
<pre><code class="lang-shell">mysql&gt; show global variables like &apos;log_bin&apos;;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+
1 row in set (0.00 sec)
</code></pre>
<pre><code class="lang-shell">mysql&gt; show global variables like &apos;log_bin&apos;;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+
1 row in set (0.00 sec)
</code></pre>
<h4 id="&#x4E0B;&#x8F7D;percona-xtrabackup">&#x4E0B;&#x8F7D;percona-xtrabackup</h4>
<p>wget <a href="https://www.percona.com/downloads/XtraBackup/XtraBackup-2.0.8/RPM/rhel6/x86_64/percona-xtrabackup-20-2.0.8-587.rhel6.x86_64.rpm" target="_blank">https://www.percona.com/downloads/XtraBackup/XtraBackup-2.0.8/RPM/rhel6/x86_64/percona-xtrabackup-20-2.0.8-587.rhel6.x86_64.rpm</a></p>
<h4 id="&#x5B89;&#x88C5;percona-xtrabackup">&#x5B89;&#x88C5;percona-xtrabackup</h4>
<pre><code class="lang-shell">rpm -ivh percona-xtrabackup-20-2.0.8-587.rhel6.x86_64.rpm
</code></pre>
<h4 id="&#x68C0;&#x67E5;percona-xtrabackup-&#x662F;&#x5426;&#x5B89;&#x88C5;&#x5B8C;&#x6210;">&#x68C0;&#x67E5;percona-xtrabackup &#x662F;&#x5426;&#x5B89;&#x88C5;&#x5B8C;&#x6210;</h4>
<pre><code class="lang-shell">rpm -aq | grep backup
percona-xtrabackup-20-2.0.8-587.rhel6.x86_64
</code></pre>
<h4 id="&#x7ED9;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x7684;root&#x8D26;&#x6237;&#x6DFB;&#x52A0;&#x5BC6;&#x7801;">&#x7ED9;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x7684;root&#x8D26;&#x6237;&#x6DFB;&#x52A0;&#x5BC6;&#x7801;</h4>
<p>mysqladmin -u root password &quot;root&quot;</p>
<h4 id="&#x5907;&#x4EFD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x6570;&#x636E;&#x5230;tmp&#x76EE;&#x5F55;">&#x5907;&#x4EFD;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x6570;&#x636E;&#x5230;tmp&#x76EE;&#x5F55;</h4>
<pre><code class="lang-shell">innobackupex --defaults-file=/etc/my.cnf --user=root --password=root /tmp
</code></pre>
<h4 id="&#x4FDD;&#x6301;&#x4E8B;&#x52A1;&#x4E00;&#x81F4;&#x6027;&#xFF08;&#x4E3A;&#x4E86;&#x4FDD;&#x8BC1;&#x5907;&#x4EFD;&#x96C6;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x4E00;&#x81F4;&#xFF09;">&#x4FDD;&#x6301;&#x4E8B;&#x52A1;&#x4E00;&#x81F4;&#x6027;&#xFF08;&#x4E3A;&#x4E86;&#x4FDD;&#x8BC1;&#x5907;&#x4EFD;&#x96C6;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x4E00;&#x81F4;&#xFF09;</h4>
<pre><code class="lang-shell">innobackupex --defaults-file=/etc/my.cnf --user=root --password=root --apply-log /tmp/2017-06-21_15-25-22/
</code></pre>
<h4 id="&#x62F7;&#x8D1D;&#x6587;&#x4EF6;&#x5230;slave">&#x62F7;&#x8D1D;&#x6587;&#x4EF6;&#x5230;slave</h4>
<pre><code class="lang-shell">scp -r /tmp/2017-06-21_15-25-22/ root@192.168.0.103:/tmp/
</code></pre>
<h4 id="&#x5728;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x4E0A;&#x521B;&#x5EFA;slave&#x8D26;&#x6237;&#x5E76;&#x6388;&#x6743;">&#x5728;&#x4E3B;&#x6570;&#x636E;&#x5E93;&#x4E0A;&#x521B;&#x5EFA;slave&#x8D26;&#x6237;&#x5E76;&#x6388;&#x6743;</h4>
<pre><code class="lang-shell">mysql&gt; CREATE USER &apos;slave&apos;@&apos;192.168.0.%&apos; IDENTIFIED BY &apos;slave&apos;;
mysql&gt; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO &apos;slave&apos;@&apos;192.168.0.%&apos;;
mysql&gt; flush privileges;
</code></pre>
<h4 id="&#x5728;&#x4ECE;&#x5E93;&#x4E0A;&#x9A8C;&#x8BC1;&#x767B;&#x9646;&#x4E3B;&#x5E93;">&#x5728;&#x4ECE;&#x5E93;&#x4E0A;&#x9A8C;&#x8BC1;&#x767B;&#x9646;&#x4E3B;&#x5E93;</h4>
<pre><code class="lang-shell">mysql&gt; mysql -h192.168.0.101 -uslave -p&apos;slave&apos;
mysql&gt; exit
</code></pre>
<h4 id="&#x505C;&#x6389;&#x4ECE;&#x5E93;">&#x505C;&#x6389;&#x4ECE;&#x5E93;</h4>
<pre><code class="lang-shell">/etc/init.d/mysqld stop
</code></pre>
<h4 id="&#x627E;&#x5230;&#x4ECE;&#x5E93;&#x7684;lib&#x76EE;&#x5F55;&#x5E76;&#x628A;&#x4E3B;&#x5E93;&#x7684;&#x6570;&#x636E;&#x62F7;&#x8D1D;&#x8FC7;&#x6765;">&#x627E;&#x5230;&#x4ECE;&#x5E93;&#x7684;lib&#x76EE;&#x5F55;&#x5E76;&#x628A;&#x4E3B;&#x5E93;&#x7684;&#x6570;&#x636E;&#x62F7;&#x8D1D;&#x8FC7;&#x6765;</h4>
<pre><code class="lang-shell">rpm -aq | grep mysql
rpm -ql mysql-server-5.1.73-8.el6_8.x86_64
cd /var/lib/mysql/ &amp;&amp; rm -rf mysql-bin.*
mv /tmp/2017-06-21_15-25-22/* /var/lib/mysql/
cd /var/lib/
chown -R mysql:mysql mysql/
chmod -R 777 mysql/                # &#x5728;&#x542F;&#x52A8;&#x6570;&#x636E;&#x5E93;&#x5931;&#x8D25;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x9700;&#x8981;&#x52A0;
</code></pre>
<h4 id="&#x5728;&#x4E3B;&#x5E93;&#x4E0A;&#x67E5;&#x770B;binlog&#x4FE1;&#x606F;">&#x5728;&#x4E3B;&#x5E93;&#x4E0A;&#x67E5;&#x770B;binlog&#x4FE1;&#x606F;</h4>
<pre><code class="lang-shell">cat /tmp/2017-06-21_15-25-22/xtrabackup_binlog_info
mysql-bin.000001    106
</code></pre>
<h4 id="&#x542F;&#x52A8;&#x4ECE;&#x5E93;&#x5E76;&#x6267;&#x884C;change-master&#x8BBE;&#x7F6E;&#x4E3B;&#x670D;&#x52A1;&#x5668;&#x590D;&#x5236;&#x4FE1;&#x606F;">&#x542F;&#x52A8;&#x4ECE;&#x5E93;&#x5E76;&#x6267;&#x884C;change master&#x8BBE;&#x7F6E;&#x4E3B;&#x670D;&#x52A1;&#x5668;&#x590D;&#x5236;&#x4FE1;&#x606F;</h4>
<pre><code class="lang-shell">/etc/init.d/mysqld start
mysql -uroot -proot
mysql&gt; change master to master_host=&apos;192.168.0.101&apos;, master_user=&apos;slave&apos;, master_password=&apos;slave&apos;, master_port=3306, master_log_file=&apos;mysql-bin.000001&apos;,master_log_pos=106;
</code></pre>
<h4 id="&#x5728;slave&#x4E0A;&#x9762;&#x542F;&#x52A8;&#x590D;&#x5236;">&#x5728;slave&#x4E0A;&#x9762;&#x542F;&#x52A8;&#x590D;&#x5236;</h4>
<pre><code class="lang-shell">mysql&gt; start slave;
</code></pre>
<h4 id="&#x68C0;&#x67E5;slave&#x542F;&#x52A8;&#x590D;&#x5236;&#x662F;&#x5426;&#x6210;&#x529F;">&#x68C0;&#x67E5;slave&#x542F;&#x52A8;&#x590D;&#x5236;&#x662F;&#x5426;&#x6210;&#x529F;</h4>
<pre><code class="lang-shell">show slave status \G
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
</code></pre>
<h4 id="&#x9A8C;&#x8BC1;&#x4E3B;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;&#x4E00;&#x81F4;&#x6027;">&#x9A8C;&#x8BC1;&#x4E3B;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x7684;&#x4E00;&#x81F4;&#x6027;</h4>
<pre><code class="lang-shell">mysql&gt; show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| wiki               |
| wordpress          |
+--------------------+
5 rows in set (0.00 sec)
</code></pre>
<h4 id="&#x9A8C;&#x8BC1;&#x4E3B;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x662F;&#x5426;&#x80FD;&#x5B9E;&#x65F6;&#x540C;&#x6B65;">&#x9A8C;&#x8BC1;&#x4E3B;&#x4ECE;&#x6570;&#x636E;&#x5E93;&#x662F;&#x5426;&#x80FD;&#x5B9E;&#x65F6;&#x540C;&#x6B65;</h4>
<p>&#x4E3B;&#x5E93;&#xFF1A;</p>
<pre><code class="lang-shell">mysql&gt; create database newtest charset utf8;
</code></pre>
<p>&#x4ECE;&#x5E93;&#xFF1A;</p>
<pre><code class="lang-shell">mysql&gt; show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| newtest            |        # &lt;--&#x4ECE;&#x5E93;&#x4E0A;&#x51FA;&#x73B0;&#x65B0;&#x5EFA;&#x7684;newtest&#x8BF4;&#x660E;&#x5B9E;&#x9A8C;&#x6210;&#x529F;&#xFF01;
| test               |
| wiki               |
| wordpress          |
+--------------------+
6 rows in set (0.00 sec)
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Day05-1.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Day05-2">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Day06","level":"1.9","depth":1,"previous":{"title":"Day05-2","level":"1.8","depth":1,"path":"Day05-1.md","ref":"Day05-1.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"Day06.md","mtime":"2017-06-21T09:35:33.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-07-01T15:45:14.694Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

